// 订单模块
import {actionType} from '../action'

const initialState = {
    list: [
        {name: 'apple', money: 999, id: 1},
        {name: 'lemon', money: 555, id: 2}
    ]
}

const orderReducer = (state = initialState, action) => {
    switch (action.type) {

        case actionType.DELORDER:
            let arr = [...state.list];
            let arr1 = arr.filter(item => {
                return item.id !== action.id
            })
            return {
                ...state,
                list: arr1
            }

        default:
            return state
    }
}

export default orderReducer